UNAME := $(shell uname)

#-----Macros---------------------------------
# jrmiddleware location
jrPATH=~/jrmiddleware

LIB = $(jrPATH)/lib/libJunior.a  `pkg-config --libs playerc`
INCLUDES = -I $(jrPATH)/include -I./include `pkg-config --cflags playerc`


ifeq ($(UNAME), Linux)
# do something Linux-y
LIB2 = -lm -pthread -lrt
endif
ifeq ($(UNAME), Darwin)
# do something mac-y
LIB2 = -lm -lpthread

endif

# set up compiler and options
CXX = g++ 
CXXFLAGS = -g $(INCLUDES)

#-----File Dependencies----------------------

SRC1 = src/PlayerJAUS.cpp
OBJ1 = $(addsuffix .o, $(basename $(SRC1)))

SRC2 = src/WaypointCOP.cpp
OBJ2 = $(addsuffix .o, $(basename $(SRC2)))

all: WaypointCOP PlayerJAUS
WaypointCOP: $(OBJ2)
	$(CXX) $(CXXFLAGS) -o $@ $(OBJ2) $(LIB) $(LIB2)
	
PlayerJAUS: $(OBJ1)
	$(CXX) $(CXXFLAGS)  -o $@ $(OBJ1) $(LIB) $(LIB2) 
	
#-----Other stuff----------------------------
clean:
	rm -f $(OBJ1) $(OBJ2)
